﻿#region Usings

using System.Data.Entity.ModelConfiguration;
using Rail.Net.Core.Model;

#endregion

namespace Rail.Net.Data.Configuration
{
    public class GlobalTrainNumberMap : EntityTypeConfiguration<GlobalTrainNumber>
    {
        public GlobalTrainNumberMap()
        {
            ToTable("GlobalTrainNumbers");
            HasKey(globalTrainNumber => globalTrainNumber.Id);

            Property(globalTrainNumber => globalTrainNumber.TrainNumber).IsRequired().HasMaxLength(10);
            Property(globalTrainNumber => globalTrainNumber.Include).IsRequired();
            Property(globalTrainNumber => globalTrainNumber.Domestic).IsRequired();
            Property(globalTrainNumber => globalTrainNumber.International).IsRequired();
            Property(globalTrainNumber => globalTrainNumber.ValidFrom).IsOptional();
            Property(globalTrainNumber => globalTrainNumber.ValidTo).IsOptional();
        }
    }
}